package redis

import (
	"github.com/spf13/viper"

	"github.com/go-redis/redis/v8"
)

func NewRedisClient() (*redis.Client, error) {
	url := viper.GetString("redis.url")

	opts, err := redis.ParseURL(url)
	if err != nil {
		return nil, err
	}

	client := redis.NewClient(opts)
	return client, err
}
